package com.mall.server.service.sms;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.dubbo.api.SmsCouponHistoryApi;
import com.mall.model.domain.SmsCouponHistory;
import com.mall.model.vo.CommonPage;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class SmsCouponHistoryService {

    @DubboReference
    private SmsCouponHistoryApi smsCouponHistoryApi;

    //根据优惠券id，使用状态，订单编号分页获取领取记录
    public CommonPage list(Integer pageNum, Integer pageSize, SmsCouponHistory history) {

        Long couponId = history.getCouponId();
        String orderSn = history.getOrderSn();
        Integer useStatus = history.getUseStatus();

        Page<SmsCouponHistory> page = smsCouponHistoryApi.listPage(pageNum, pageSize, couponId, orderSn, useStatus);

        return new CommonPage(page);
    }

}
